export default [
    {
        click: (e, instance, hide) => {
            const { IMUI, message } = instance;
            const data = {
                id: generateRandId(),
                type: "event",
                //使用 jsx 时 click必须使用箭头函数（使上下文停留在vue内）
                content: (
                    <div>
                  <span>
                    你撤回了一条消息{" "}
                      <span
                          v-show={message.type == "text"}
                          style="color:#333;cursor:pointer"
                          content={message.content}
                          on-click={e => {
                              IMUI.setEditorValue(e.target.getAttribute("content"));
                          }}
                      >
                      重新编辑
                    </span>
                  </span>
                    </div>
                ),

                toContactId: message.toContactId,
                sendTime: getTime(),
            };
            IMUI.removeMessage(message.id);
            IMUI.appendMessage(data, true);
            hide();
        },
        visible: instance => {
            return instance.message.fromUser.id == this.user.id;
        },
        text: "撤回消息",
    },
    {
        visible: instance => {
            return instance.message.fromUser.id != this.user.id;
        },
        text: "举报",
    },
    {
        text: "转发",
    },
    {
        visible: instance => {
            return instance.message.type == "text";
        },
        text: "复制文字",
    },
    {
        visible: instance => {
            return instance.message.type == "image";
        },
        text: "下载图片",
    },
    {
        visible: instance => {
            return instance.message.type == "file";
        },
        text: "下载文件",
    },
    {
        click: (e, instance, hide) => {
            const { IMUI, message } = instance;
            IMUI.setUserTag(message.fromUser);
            hide();
        },
        text: "@TA",
    },
    {
        click: (e, instance, hide) => {
            const { IMUI, message } = instance;
            IMUI.removeMessage(message.id);
            hide();
        },
        icon: "lemon-icon-folder",
        color: "red",
        text: "删除",
    },
]